package com.woniu.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.common.dto.CartDto;
import com.woniu.common.util.ResponseData;
import com.woniu.product.dto.SkuDto;
import com.woniu.product.pojo.TProductSku;
import com.woniu.product.service.TProductSkuService;
import com.woniu.product.mapper.TProductSkuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 91211
* @description 针对表【t_product_sku(商品表)】的数据库操作Service实现
* @createDate 2024-05-20 22:25:53
*/
@Service
public class TProductSkuServiceImpl extends ServiceImpl<TProductSkuMapper, TProductSku>
    implements TProductSkuService{
    @Autowired
    private TProductSkuMapper skuMapper;

    @Override
    public ResponseData<?> querySku(Long spuId) {
        List<SkuDto> skuDtoList = skuMapper.querySku(spuId);
        return new ResponseData<>().ok(skuDtoList);
    }

    @Override
    public void updateStore(List<CartDto> shops) {
        skuMapper.updateStore(shops);
    }

    @Override
    public TProductSku querySkuType(Long skuId) {
        return skuMapper.querySkuType(skuId);
    }

    @Override
    public ResponseData<?> querySkuById(Long skuId) {
        List<SkuDto> skuDtoList = skuMapper.querySkuById(skuId);
        return new ResponseData<>().ok(skuDtoList);
    }

    @Override
    public List<TProductSku> queryAllDetail() {
        return skuMapper.queryAllDetail();
    }
}




